/*
 * @Author: your name
 * @Date: 2020-11-06 11:26:24
 * @LastEditTime: 2021-06-15 10:28:55
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \sende_nuxt\store\index1.js
 */
import { getCategories } from '@/api/content';
import { treeUtils } from '@/utils/Utils';
export const state = () => ({

})
export const mutations = ({
  
})
export const actions = {
  async fetch({ app, store, params }) {
  },
  // 系统初始化时(context上下文对象在第二个参数中)
  async nuxtServerInit({ commit }, { app, req, $axios }) {
    // 在系统初始化时，可以在这里请求某些接口，写入vuex，然后可以在客户端获取vuex数据
    // await fetchMemberInfo().then((res) => {
    //   console.log(res)
    // })
    /** 从cookie中提取token到vuex **/
    // app.$cookies.get('token') ? commit('SET_TOKEN', this.$cookies.get('token')) : '';
    /** 从cookie中提取language到vuex **/
    // app.$cookies.get('language') ? commit('content/SET_LANGUAGE', this.$cookies.get('language')) : 'en';
    // let result = await getCategories();
    // const menuArr = await treeUtils(result.items);
    // let menuArr2 = [
    //   {
    //     toRoute: '/eyeglasses',
    //     title: 'home.Eyeglasses'
    //   },
    //   {
    //      toRoute: '/sunglasses',
    //     title: 'home.Sunglasses'       
    //   },
    //   {
    //     toRoute: '/accessories',
    //     title: 'home.Accessories'
    //   },
    //   {
    //      toRoute: '/explore',
    //     title: 'home.Explore'       
    //   },
    //   {
    //     toRoute: '/deals',
    //     title: 'home.Deals'
    //   },
    //   {
    //     toRoute: '/about',
    //     title: 'home.About'
    //   }
    // ]
    // commit('content/SET_NAV', menuArr2)
  }
}